home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / add123 / u123.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1995-12-22  |  23.1 KB  |  751 lines

  1. UNIT U123;  {Soure PC MAG. DECEMBER 13 1988... and others}
  2.             { YES !  I did it in TP seven years Ago !!!}
  3.  
  4. INTERFACE
  5.  
  6. {
  7. This routines ARE simple to use as 123.. :-)
  8. 1)  Open the file
  9. 2)  Add what you want.. where you want
  10. 3)  Close the File
  11. }
  12.  
  13. PROCEDURE Open123(n:string);
  14. PROCEDURE Close123;
  15. PROCEDURE ColW123(c:integer; a:byte);
  16. PROCEDURE Add123Int(c,f:integer; v:integer);
  17. PROCEDURE Add123Rea(c,f:integer; v:double);
  18. PROCEDURE Add123TXC(c,f:integer; v:string);
  19. PROCEDURE Add123TXL(c,f:integer; v:string);
  20. PROCEDURE Add123TXR(c,f:integer; v:string);
  21. PROCEDURE Add123FML(c,f:integer; s:string);
  22.  
  23. {
  24.   Open123(n:string);
  25.   n = File Name WITHOUT EXTENSION it ALways add WK1
  26.   It didn't check for a valid File Name or Existing, is
  27.   YOUR responsability to do that
  28.  
  29.  
  30.   Close123;
  31.   Close the Open File .. Always DO THIS !
  32.  
  33.   In the rest of PROCEDURES c=Column and f=Row
  34.   c and F begins with 0 (cero)
  35.   if you want to Add in cell A1, use c=0 f=0
  36.   if you want to Add in cell B2, use c=1 f=1
  37.   etc.
  38.  
  39.  
  40.   Add123Int(c,f:integer; v:integer);
  41.   Add a Integer value (v) in Col=c  Row=f
  42.  
  43.   Add123Rea(c,f:integer; v:double);
  44.   Add a Double value (v) in Col=c  Row=f
  45.  
  46.   Add123TXC(c,f:integer; v:string);
  47.   Add a Label (v) in Col=C  Row=f
  48.   - Label CENTER -
  49.  
  50.   Add123TXR(c,f:integer; v:string);
  51.   Add a Label (v) in Col=C  Row=f
  52.   - Label at RIGHT -
  53.  
  54.   Add123TXL(c,f:integer; v:string);
  55.   Add a Label (v) in Col=C  Row=f
  56.   - Label at LEFT -
  57.  
  58.   ColW123(c:integer; a:byte);
  59.   Change width of Col=c to size=a
  60.  
  61.   Add123FML(c,f:integer; s:string);
  62.   Add Formula (s) at Col=c  Row=f
  63.  
  64.   Examples:
  65.            Add123FML(0,0,'A5+B2+A3*C5');
  66.            Add123FML(0,1,'@Sum(B1..B8)');
  67.  
  68.   ==========================================
  69.   THE ONLY VALID @ function is SUM   !!!!
  70.   Sorry :-(
  71.   ==========================================
  72.  
  73. }
  74.  
  75.  
  76. { The rest of Comments are in SPANISH ... Sorry again }
  77.  
  78.  
  79. IMPLEMENTATION
  80. CONST
  81.      C00 = $00;
  82.      CFF = $FF;
  83.  
  84. VAR
  85.    ALotus : File;
  86.  
  87. PROCEDURE Open123(n:string);
  88.  
  89. Type
  90.     Abre = record
  91.                    Cod  : integer;
  92.                    Lon  : integer;
  93.                    Vlr  : integer;
  94.              end;
  95.  
  96. Var
  97.    Formato  : array[1..6] of byte;
  98.    Registro : Abre absolute Formato;
  99.  
  100.  
  101. Begin
  102.      Assign(ALotus,n+'.WK1');
  103.      Rewrite(ALotus,1);
  104.      with Registro do
  105.      begin
  106.           Cod:=0;
  107.           Lon:=2;
  108.           Vlr:=1030;
  109.      end;
  110.      BlockWrite(ALotus,Formato[1],6);
  111. End;
  112.  
  113. PROCEDURE Close123;
  114.  
  115. Type
  116.     Cierra = record
  117.                    Cod  : integer;
  118.                    Lon  : integer;
  119.              end;
  120.  
  121. Var
  122.    Formato  : array[1..4] of byte;
  123.    Registro : Cierra absolute Formato;
  124.  
  125.  
  126. Begin
  127.      with Registro do
  128.      begin
  129.           Cod:=1;
  130.           Lon:=0;
  131.      end;
  132.      BlockWrite(ALotus,Formato[1],4);
  133.      Close(ALotus);
  134. End;
  135.  
  136. PROCEDURE ColW123(c:integer; a:byte);
  137.  
  138. Type
  139.     Ancho = record
  140.                    Cod  : integer;
  141.                    Lon  : integer;
  142.                    Col  : integer;
  143.                    Anc  : byte;
  144.              end;
  145.  
  146. Var
  147.    Formato  : array[1..7] of byte;
  148.    Registro : Ancho absolute Formato;
  149.  
  150.  
  151. Begin
  152.      with Registro do
  153.      begin
  154.           Cod:=8;
  155.           Lon:=3;
  156.           Col:=c;
  157.           Anc:=a;
  158.      end;
  159.      BlockWrite(ALotus,Formato[1],7);
  160. End;
  161.  
  162.  
  163. PROCEDURE Add123Int(c,f,v:integer);
  164.  
  165. Type
  166.     Entero = record
  167.                    Cod  : integer;
  168.                    Lon  : integer;
  169.                    Frm  : byte;
  170.                    Col  : integer;
  171.                    Fil  : integer;
  172.                    Vlr  : integer;
  173.              end;
  174.  
  175. Var
  176.    Formato  : array[1..11] of byte;
  177.    Registro : Entero absolute Formato;
  178.  
  179. Begin
  180.      with Registro do
  181.      begin
  182.           Cod:=13;
  183.           Lon:=7;
  184.           Frm:=255;
  185.           Fil:=f;
  186.           Col:=c;
  187.           Vlr:=v;
  188.      end;
  189.  
  190.      Blockwrite(ALotus,Formato[1],11);
  191. End;
  192.  
  193. PROCEDURE Add123Rea(c,f:integer; v:double);
  194. Type
  195.     Entero = record
  196.                    Cod  : integer;
  197.                    Lon  : integer;
  198.                    Frm  : byte;
  199.                    Col  : integer;
  200.                    Fil  : integer;
  201.                    Vlr  : double;
  202.              end;
  203. Var
  204.    Formato  : array[1..17] of byte;
  205.    Registro : Entero absolute Formato;
  206. Begin
  207.      with Registro do
  208.      begin
  209.           Cod:=14;
  210.           Lon:=13;
  211.           Frm:=2 or 128;
  212.           Fil:=f;
  213.           Col:=c;
  214.           Vlr:=v;
  215.      end;
  216.  
  217.      Blockwrite(ALotus,Formato[1],17);
  218. End;
  219.  
  220.  
  221. PROCEDURE GrabaTXT(c,f:integer; v:string; t:char);
  222. Type
  223.     Entero = record
  224.                    Cod  : integer;
  225.                    Lon  : integer;
  226.                    Frm  : byte;
  227.                    Col  : integer;
  228.                    Fil  : integer;
  229.                    Vlr  : array[1..100] of char;
  230.              end;
  231. Var
  232.    Formato  : array[1..109] of byte;
  233.    Registro : Entero absolute Formato;
  234.    i        : word;
  235. Begin
  236.      with Registro do
  237.      begin
  238.           Cod:=15;
  239.           Lon:=length(v)+7;
  240.           Frm:=255;
  241.           Fil:=f;
  242.           Col:=c;
  243.           Vlr[1]:=t;
  244.           for i:=1 to Length(v) do Vlr[i+1]:=v[i];
  245.           Vlr[i+2]:=chr(0);
  246.      end;
  247.      Blockwrite(ALotus,Formato[1],length(v)+11);
  248. End;
  249.  
  250. PROCEDURE Add123TXL(c,f:integer; v:string);
  251. begin
  252.      GrabaTXT(c,f,v,'''');
  253. end;
  254. PROCEDURE Add123TXC(c,f:integer; v:string);
  255. begin
  256.      GrabaTXT(c,f,v,'^');
  257. end;
  258. PROCEDURE Add123TXR(c,f:integer; v:string);
  259. begin
  260.      GrabaTXT(c,f,v,'"');
  261. end;
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. PROCEDURE Add123FML(c,f:integer; s:string);
  269.  
  270. Type
  271.     Formula = record
  272.                     Cod : integer;                {codigo}
  273.                     Lon : integer;                {longitud}
  274.                     Frm : byte;                   {formato}
  275.                     Col : integer;                {columna}
  276.                     Fil : integer;                {fila}
  277.                     Res : Double;                {resultado de formula}
  278.                     Tma : integer;                {tamanio de formula en bytes}
  279.                     Fml : array[1..2048] of byte; {formula}
  280.               end;
  281.     symbol = (cel,num,arr,mas,men,por,dvs,pot,pa1,pa2);
  282.     consym = set of symbol;
  283.  
  284. Var
  285.    Formato   : array[1..2067] of byte;
  286.    Registro  : Formula absolute Formato;
  287.    fabs      : boolean;                {flag que indica si ffml es absoluta}
  288.    v,                                  {v    = string 's' sin blancos}
  289.    nro       : string;                 {nro  = numero de ffml}
  290.    cfml,                               {cfml = valor de columna en formula}
  291.    ffml      : word;                   {ffml =   "    " fila     "    "   }
  292.    nfml,                               {nfml =   "    " constante "   "   }
  293.    i,                                  {i    = indice de 'v' (formula) }
  294.    ii,                                 {ii   =    "    " 's'     "     }
  295.    index,                              {index=    "    " Fml}
  296.    j,ret,                              {usados para convertir a numeros}
  297.    len,                                {len  = longitud de 'v'}
  298.    lens      : integer;                {lens =     "     " 's'}
  299.    sym       : symbol;                 {sym  = ultimo simbolo leido}
  300.    symsig,                             {usados para analizar formula para }
  301.    syminifac : consym;                 {grabarla con notacion posfija     }
  302.    z         : byte;                   {indice para inicializar array}
  303.  
  304.  
  305.    Procedure CalculaDir(var Reg : Formula);
  306.  
  307.    var
  308.       veces : integer;
  309.  
  310.       (*   Primero, se decide si cfml es absoluta o relativa. Si es absoluta
  311.            calcula el valor real. Si es relativa primero chequea si cfml<col.
  312.            Si cfml<col le resta cfml a 49152 (C000); este numero es usado por
  313.            Lotus para calcular la direccion de una celda a la izquierda de
  314.            donde esta parado. Si col<=cfml le suma cfml a 32768 para encender
  315.            el MSB que indica que es relativa (la C tambien lo prende).
  316.  
  317.            Segundo, se procede de la misma manera con ffml para determinar si
  318.            es absoluta o relativa, y despues se calcula la direccion en base
  319.            a eso y a la relacion de ffml con fil.
  320.       *)
  321.  
  322.    begin
  323.         with Reg do
  324.         begin
  325.              if v[i]='$' then             {calcula la columna (cfml)}
  326.              begin
  327.                   inc(i);
  328.                   cfml:=ord(v[i])-ord('A');
  329.                   inc(i);
  330.                   while (v[i] in ['A'..'Z']) and (len>=i) do
  331.                   begin
  332.                        cfml:=(cfml+1)*26+ord(v[i])-ord('A');
  333.                        inc(i);
  334.                   end;
  335.              end
  336.              else
  337.              begin
  338.                   if (ord(v[i])-ord('A') < col) then
  339.                   begin
  340.                        cfml:=49152-col+(ord(v[i])-ord('A'));
  341.                        inc(i);
  342.                        veces:=1;
  343.                        while (v[i] in ['A'..'Z']) and (len>=i) do
  344.                        begin
  345.                             cfml:=49152-col+(26*veces)+(ord(v[i])-ord('A'));
  346.                             cfml:=cfml+((ord(v[i-1])-ord('A'))*26);
  347.                             inc(i);
  348.                             inc(veces);
  349.                        end;
  350.                   end
  351.                   else
  352.                   begin
  353.                        cfml:=ord(v[i])-ord('A');
  354.                        inc(i);
  355.                        while (v[i] in ['A'..'Z']) and  (len>=i) do
  356.                        begin
  357.                             cfml:=(cfml+1)*26+ord(v[i])-ord('A');
  358.                             inc(i);
  359.                        end;
  360.                        cfml:=cfml+32768-col;
  361.                   end;
  362.              end;
  363.  
  364.              Fml[index]:=Lo(cfml);        {graba cfml}
  365.              inc(index);                  {que posee }
  366.              Fml[index]:=Hi(cfml);        {dos bytes }
  367.              inc(index);
  368.  
  369.              if v[i]='$' then             {calcula la fila (ffml)}
  370.              begin
  371.                   inc(i);
  372.                   fabs:=true;
  373.              end
  374.              else
  375.                  fabs:=false;
  376.              j:=i;
  377.              while (v[i] in ['0'..'9']) and (len>=i) do
  378.              begin
  379.                   inc(i);
  380.              end;
  381.              nro:=copy(v,j,i-j);
  382.              val(nro,ffml,ret);
  383.  
  384.              if fabs then                 {siempre se resta 1 por estar en base 0}
  385.              begin
  386.                   if ffml>0 then ffml:=ffml-1;
  387.              end
  388.              else
  389.              begin
  390.                   if fil<ffml then
  391.                   begin
  392.                        ffml:=32768+abs(ffml-fil)-1;
  393.                   end
  394.                   else
  395.                   begin
  396.                        ffml:=49152-abs(ffml-fil)-1;
  397.                   end;
  398.              end;
  399.  
  400.              Fml[index]:=Lo(ffml);        {graba ffml}
  401.              inc(index);                  {que posee }
  402.              Fml[index]:=Hi(ffml);        {dos bytes }
  403.              inc(index);
  404.         end;
  405.    end;
  406.  
  407.    Procedure CalculaNum(var Reg : Formula);
  408.  
  409.    var
  410.       VDoble  : array[1..8] of byte;
  411.       dfml    : Double absolute VDoble;
  412.       d       : real;
  413.       esreal  : boolean;
  414.       k       : byte;
  415.       numero  : longint;
  416.       codigo  : integer;
  417.  
  418.    begin
  419.         with Reg do
  420.         begin
  421.              esreal:=false;
  422.              j:=i;
  423.              while (v[i] in ['0'..'9','.']) and (len>=i) do
  424.              begin
  425.                   if v[i]='.' then esreal:=true;
  426.                   inc(i);
  427.              end;
  428.              nro:=copy(v,j,i-j);
  429.              {R-}
  430.                  val(nro,numero,codigo);
  431.              {R+}
  432.                  if (codigo=0) and (numero>=-32768) and (numero<=32767) then
  433.                     esreal:=false
  434.                  else
  435.                      esreal:=true;
  436.  
  437.              if esreal then
  438.              begin
  439.                   val(nro,d,ret);             {convierte en real doble}
  440.                   dfml:=d;
  441.                   {ConvRD(d,dfml);}
  442.  
  443.                   Fml[index]:=0;              {0 = indica que sigue una constante}
  444.                   inc(index);                 {    real doble precision (8 bytes)}
  445.                   for k:=1 to 8 do
  446.                   begin
  447.                        Fml[index]:=VDoble[k];   {graba dfml}
  448.                        inc(index);            {son ocho bytes}
  449.                   end;
  450.              end
  451.              else
  452.              begin
  453.                   val(nro,nfml,ret);          {convierte en entero}
  454.  
  455.                   Fml[index]:=5;              {5 = indica que sigue una constante }
  456.                   inc(index);                 {    entera con signo (2 bytes)     }
  457.                   Fml[index]:=Lo(nfml);       {graba nfml}
  458.                   inc(index);                 {son dos bytes}
  459.                   Fml[index]:=Hi(nfml);
  460.                   inc(index);
  461.              end;
  462.              dec(i);
  463.         end;
  464.    end;
  465.  
  466.    Procedure CalculaRan(var Reg : Formula);
  467.  
  468.    begin
  469.         with Reg do
  470.         begin
  471.              Fml[index]:=2;               {2 = codigo de rango; le sigue 8 bytes}
  472.              inc(index);                  {    que son (col1fil1..col2fil2)     }
  473.  
  474.              CalculaDir(Reg);             {calcula col1fil1}
  475.              i:=i+2;                      {salta los 2 ..  }
  476.              CalculaDir(Reg);             {calcula col2fil2}
  477.         end;
  478.    end;
  479.  
  480.    Procedure CalculaArr(var Reg : Formula);
  481.  
  482.    {** SOLO CODIFICA @TRUE,@FALSE,@SUM(COL1FIL1..COL2FIIL2) **}
  483.  
  484.    var
  485.       func,dir : string;                  {func  = string del @}
  486.                                           {dir   = del rango}
  487.       N_arg,nc : byte;                    {N_arg = cantidad de argumentos}
  488.                                           {nc    = numero de codigo (T,F,S)}
  489.  
  490.    begin
  491.         with Reg do
  492.         begin
  493.              inc(i);
  494.              case v[i] of
  495.                          'F' : nc:=51;
  496.                          'T' : nc:=52;
  497.                          'S' : nc:=80;
  498.              end;
  499.  
  500.              while (v[i] in ['A'..'Z']) and (len>=i) do inc(i);
  501.              inc(i);
  502.              if nc=80 then
  503.              begin
  504.                   CalculaRan(Reg);        {calcula el rango (col1fil1..col2fil2}
  505.                   N_arg:=1;               {hay un solo argumento}
  506.              end;
  507.  
  508.              Fml[index]:=nc;
  509.              inc(index);
  510.              if nc=80 then
  511.              begin
  512.                   Fml[index]:=N_arg;      {graba numero de argumentos}
  513.                   inc(index);
  514.              end;
  515.         end;
  516.    end;
  517.  
  518.    Procedure TraerChar;
  519.  
  520.    begin
  521.         inc(i);                           {carga el simbolo para }
  522.         if len>=i then                    {la recursividad       }
  523.         begin
  524.              case v[i] of
  525.                          'A'..'Z','$' : sym:=cel;
  526.                          '0'..'9','.' : sym:=num;
  527.                          '@'          : sym:=arr;
  528.                          '+'          : sym:=mas;
  529.                          '-'          : sym:=men;
  530.                          '*'          : sym:=por;
  531.                          '/'          : sym:=dvs;
  532.                          '^'          : sym:=pot;
  533.                          '('          : sym:=pa1;
  534.                          ')'          : sym:=pa2;
  535.              end;
  536.         end;
  537.    end;
  538.  
  539.  
  540.    Procedure Expresion(symsig : consym; var Reg : Formula);
  541.    var
  542.       opsuma:symbol;
  543.  
  544.    Procedure Termino(symsig : consym; var Reg : Formula);
  545.    var
  546.       opmul:symbol;
  547.  
  548.    Procedure Factor(symsig : consym; var Reg : Formula);
  549.    var
  550.       opexp:symbol;
  551.  
  552.    Procedure Exponente(symsig : consym; var Reg : Formula);
  553.  
  554.    begin{Exponente}
  555.         while (sym in syminifac) and (len>=i) do
  556.         begin
  557.              case sym of
  558.                         num : begin
  559.                                    CalculaNum(Registro);
  560.                                    TraerChar;
  561.                               end;
  562.                         cel : begin
  563.                                    Reg.Fml[index]:=1;
  564.                                    inc(index);
  565.                                    CalculaDir(Registro);
  566.                                    dec(i);
  567.                                    TraerChar;
  568.                               end;
  569.                         arr : begin
  570.                                    CalculaArr(Registro);
  571.                                    TraerChar;
  572.                               end;
  573.              else
  574.                  begin
  575.                       if sym=pa1 then
  576.                       begin
  577.                            TraerChar;
  578.                            Expresion([pa2]+symsig,Registro);
  579.                            if sym=pa2 then
  580.                            begin
  581.                                 Reg.Fml[index]:=4;       {4 = simbolo '(' }
  582.                                 inc(index);
  583.                                 TraerChar;
  584.                            end;
  585.                       end;
  586.                  end;
  587.              end;
  588.         end;
  589.    end;{Exponente}
  590.  
  591.    begin{Factor}
  592.         Exponente(symsig+[pot],Registro);
  593.         while (sym=pot) and (len>=i) do
  594.         begin
  595.              opexp:=sym;
  596.              TraerChar;
  597.              Exponente(symsig+[pot],Registro);
  598.              if opexp=pot then
  599.              begin
  600.                   Reg.Fml[index]:=13;                    {13 = simbolo '^' }
  601.                   inc(index);
  602.              end;
  603.         end;
  604.    end;{Factor}
  605.  
  606.    begin{Termino}
  607.         Factor(symsig+[por,dvs],Registro);
  608.         while (sym in [por,dvs]) and (len>=i) do
  609.         begin
  610.              opmul:=sym;
  611.              TraerChar;
  612.              Factor(symsig+[por,dvs],Registro);
  613.              if (opmul=por) or (opmul=dvs) then
  614.              begin
  615.                   if opmul=por then Reg.Fml[index]:=11   {11 = simbolo '*' }
  616.                   else
  617.                       Reg.Fml[index]:=12;                {12 = simbolo '/' }
  618.                   inc(index);
  619.              end;
  620.         end;
  621.    end;{Termino}
  622.  
  623.    begin{Expresion}
  624.  
  625.       (*   Este es el primero de cuatro procedimientos recursivos (Expresion,
  626.            Termino, Factor y Exponente) que se usan para transformar la formula
  627.            en una expresion en notacion posfija, tal como se debe grabar. La
  628.            tecnica consiste en retrasar la transmision del operador aritmetico.
  629.            Ejemplo:  a+(b*c)^d  ==>  abc*(d^+  .
  630.  
  631.            Expresion analiza si es suma o resta. Luego llama a Termino. Al
  632.            volver trae el proximo dato y llama otra vez a Termino. Al volver
  633.            genera el codigo de suma o resta si hubo.
  634.  
  635.            Termino llama a Factor. Al volver trae el proximo dato y llama otra
  636.            vez a Factor. Al volver genera el codigo de multiplicacion o division
  637.            si hubo.
  638.  
  639.            Factor llama a Exponente. Al volver trae el proximo dato y llama
  640.            otra vez a Exponente. Cuando vuele genera el codigo de exponenciacion
  641.            si hubo.
  642.  
  643.            Exponente analiza si el valor es un numero, una celda, un arroba o
  644.            un parentesis. Si es un parentesis, vuelve a llamar a Expresion para
  645.            calcular el contenido este; sino genera el codigo correspondiente.
  646.  
  647.       *)
  648.  
  649.         if sym in [mas,men] then
  650.         begin
  651.              opsuma:=sym;
  652.              TraerChar;
  653.              Termino(symsig+[mas,men],Registro);
  654.              if opsuma=men then
  655.              begin
  656.                   Reg.Fml[index]:=8;                     {8 = simbolo '-' unario}
  657.                   inc(index);
  658.              end;
  659.         end
  660.         else
  661.             Termino(symsig+[mas,men],Registro);
  662.         while (sym in [mas,men]) and (len>=i) do
  663.         begin
  664.              opsuma:=sym;
  665.              TraerChar;
  666.              Termino(symsig+[mas,men],Registro);
  667.              if (opsuma=mas) or (opsuma=men) then
  668.              begin
  669.                   if opsuma=mas then Reg.Fml[index]:=9   { 9 = simbolo '+' }
  670.                   else
  671.                       Reg.Fml[index]:=10;                {10 = simbolo '-' }
  672.                   inc(index);
  673.              end;
  674.         end;
  675.    end;{Expresion}
  676.  
  677.  
  678. Begin
  679.      with Registro do
  680.      begin
  681.           Cod:=16;                     {16= formula}
  682.           Col:=c;
  683.           Fil:=f;
  684.  
  685.           Frm:=0;                      {Comienzo con 0}
  686. (*
  687.           if p=true then Frm:=Frm+128; {Si se protege se prende el MSB}
  688.  
  689.           ch:=UpCase(ch);              {Veo que formato se quiere y prendo }
  690.                                        {los bits respectivos               }
  691.           case ch of
  692.                    'F' : Frm:=Frm+  0; {'F' ==> decimales fijos    }
  693.                    'S' : Frm:=Frm+ 16; {'S' ==> notacion cientifica}
  694.                    'C' : Frm:=Frm+ 32; {'C' ==> moneda corriente   }
  695.                    'P' : Frm:=Frm+ 48; {'P' ==> porcentaje         }
  696.                    'M' : Frm:=Frm+ 64; {',' ==> miles con comas    }
  697.                    'O' : Frm:=Frm+112; {'O' ==> otros              }
  698.           end;
  699.  
  700.           Frm:=Frm+d;                  {Si ch<>'O' ==> d= cant. de decimales}
  701.                                        {Si ch= 'O' ==> d= 1 --> general     }
  702.                                        {                  2 --> DD/MMM/AA   }
  703.                                        {                  3 --> DD/MMM      }
  704.                                        {                  4 --> MM/AA       }
  705.                                        {                  5 --> texto       }
  706.                                        {                  6 --> hidden      }
  707.                                        {                  7 --> date; HH-MM-SS}
  708.                                        {                  8 --> date; HH-MM }
  709.                                        {                  9 --> date; int'l 1 }
  710.                                        {                 10 --> date; int'l 2 }
  711.                                        {                 11 --> time; int'l 1 }
  712.                                        {                 12 --> time; int'l 2 }
  713.                                        {              13-14 --> no utilizado}
  714.                                        {                 15 --> default     }
  715.  
  716.   *)
  717.            Res:=C00;
  718. {          for z:=1 to 8 do Res[z]:=C00;} {se modifica automaticamente cuando se recalcula y regraba}
  719.  
  720.           lens:=length(s);             {convierto todo a mayusculas}
  721.           for ii:=1 to lens do s[ii]:=UpCase(s[ii]);
  722.           i:=1;
  723.           v:='';
  724.           for ii:=1 to lens do         {paso el string 's' al string 'v' }
  725.           begin                        {eliminando los espacios en blanco}
  726.                if s[ii]<>' ' then
  727.                begin
  728.                     v:=v+s[ii];
  729.                     inc(i);
  730.                end;
  731.           end;
  732.  
  733.           len:=i-1;
  734.           i:=0;
  735.           index:=1;
  736.  
  737.           syminifac:=[cel,num,arr,pa1];
  738.           symsig:=syminifac;
  739.  
  740.           TraerChar;                   {toma el primer caracter de formula}
  741.           Expresion(symsig,Registro);  {analiza y graba toda la formula}
  742.  
  743.           Fml[index]:=3;               {3 = fin de formula}
  744.           Tma:=index;                  {tamanio de Fml}
  745.           Lon:=15+Tma;                 {longitud de dato}
  746.           BlockWrite(ALotus,Formato[1],19+index);
  747.      end;
  748. End;
  749.  
  750.  
  751. END.